public class AnimalTest {
    public static void main(String[] args){
        Feeder feeder = new Feeder("张昕");
        feeder.speak();
        Food catfood = new Food() {
            Fish fish = new Fish("鱼") {
                @Override
                public void eat() {
                }
            };
            @Override
            public String getName() {
                return fish.getName();
            }
        };
        Food food = new Food() {
            @Override
            public String getName() {
                Bone bone = new Bone() {
                    @Override
                    public String getName() {
                        return super.getName();
                    }
                };
                return bone.getName();
            }
        };
        Dog dog = new Dog("小狗");
        Cat cat = new Cat("小猫");
        feeder.feed(dog.getName());
        dog.eat();
        System.out.println(food.getName());
        dog.shout();
        feeder.feed(cat.getName());
        cat.eat();
        System.out.println(catfood.getName());
        cat.shout();
    }
}
